<%@ CodePage="936" LCID="2052" %>
<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="lc_ewcfg8.asp"-->
<!--#include file="lc_donationinfo.asp"-->
<!--#include file="lc_userinfo.asp"-->
<!--#include file="lc_aspfn8.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="lc_userfn8.asp"-->
<% Session.Timeout = 20 %>
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate"
%>
<%

' Define page object
Dim donation_view
Set donation_view = New cdonation_view
Set Page = donation_view

' Page init processing
Call donation_view.Page_Init()

' Page main processing
Call donation_view.Page_Main()
%>
<!--#include file="lc_header.asp"-->
<% If donation.Export = "" Then %>
<script type="text/javascript">
<!--
// Create page object
var donation_view = new ew_Page("donation_view");
// page properties
donation_view.PageID = "view"; // page ID
donation_view.FormID = "fdonationview"; // form ID
var EW_PAGE_ID = donation_view.PageID; // for backward compatibility
// extend page with Form_CustomValidate function
donation_view.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!
 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
donation_view.SelectAllKey = function(elem) {
	ew_SelectAll(elem);
}
<% If EW_CLIENT_VALIDATE Then %>
donation_view.ValidateRequired = true; // uses JavaScript validation
<% Else %>
donation_view.ValidateRequired = false; // no JavaScript validation
<% End If %>
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->
</script>
<% End If %>
<p><span class="aspmaker"><%= Language.Phrase("View") %>&nbsp;<%= Language.Phrase("TblTypeTABLE") %><%= donation.TableCaption %>
<% If donation.Export = "" Then %>
&nbsp;&nbsp;<a href="<%= donation_view.ExportPrintUrl %>"><%= Language.Phrase("PrinterFriendly") %></a>
&nbsp;&nbsp;<a href="<%= donation_view.ExportHtmlUrl %>"><%= Language.Phrase("ExportToHtml") %></a>
&nbsp;&nbsp;<a href="<%= donation_view.ExportExcelUrl %>"><%= Language.Phrase("ExportToExcel") %></a>
<% End If %>
<br><br>
<% If donation.Export = "" Then %>
<a href="<%= donation_view.ListUrl %>"><%= Language.Phrase("BackToList") %></a>&nbsp;
<% If Security.IsLoggedIn() Then %>
<a href="<%= donation_view.AddUrl %>"><%= Language.Phrase("ViewPageAddLink") %></a>&nbsp;
<% End If %>
<% If Security.IsLoggedIn() Then %>
<a href="<%= donation_view.EditUrl %>"><%= Language.Phrase("ViewPageEditLink") %></a>&nbsp;
<% End If %>
<% If Security.IsLoggedIn() Then %>
<a onclick="return ew_Confirm(ewLanguage.Phrase('DeleteConfirmMsg'));" href="<%= donation_view.DeleteUrl %>"><%= Language.Phrase("ViewPageDeleteLink") %></a>&nbsp;
<% End If %>
<% End If %>
</span></p>
<% If EW_DEBUG_ENABLED Then Response.Write donation_view.DebugMsg %>
<% donation_view.ShowMessage %>
<p>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<div class="ewGridMiddlePanel">
<table cellspacing="0" class="ewTable">
<% If donation.id.Visible Then ' id %>
	<tr<%= donation.id.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.id.FldCaption %></td>
		<td<%= donation.id.CellAttributes %>>
<div<%= donation.id.ViewAttributes %>><%= donation.id.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.company_id.Visible Then ' company_id %>
	<tr<%= donation.company_id.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.company_id.FldCaption %></td>
		<td<%= donation.company_id.CellAttributes %>>
<div<%= donation.company_id.ViewAttributes %>><%= donation.company_id.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.donation_date.Visible Then ' donation_date %>
	<tr<%= donation.donation_date.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.donation_date.FldCaption %></td>
		<td<%= donation.donation_date.CellAttributes %>>
<div<%= donation.donation_date.ViewAttributes %>><%= donation.donation_date.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.donation_content.Visible Then ' donation_content %>
	<tr<%= donation.donation_content.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.donation_content.FldCaption %></td>
		<td<%= donation.donation_content.CellAttributes %>>
<div<%= donation.donation_content.ViewAttributes %>><%= donation.donation_content.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.donation_money.Visible Then ' donation_money %>
	<tr<%= donation.donation_money.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.donation_money.FldCaption %></td>
		<td<%= donation.donation_money.CellAttributes %>>
<div<%= donation.donation_money.ViewAttributes %>><%= donation.donation_money.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.donation_flower.Visible Then ' donation_flower %>
	<tr<%= donation.donation_flower.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.donation_flower.FldCaption %></td>
		<td<%= donation.donation_flower.CellAttributes %>>
<div<%= donation.donation_flower.ViewAttributes %>><%= donation.donation_flower.ViewValue %></div>
</td>
	</tr>
<% End If %>
<% If donation.donation_egg.Visible Then ' donation_egg %>
	<tr<%= donation.donation_egg.RowAttributes %>>
		<td class="ewTableHeader"><%= donation.donation_egg.FldCaption %></td>
		<td<%= donation.donation_egg.CellAttributes %>>
<div<%= donation.donation_egg.ViewAttributes %>><%= donation.donation_egg.ViewValue %></div>
</td>
	</tr>
<% End If %>
</table>
</div>
</td></tr></table>
<% If donation.Export = "" Then %>
<br>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<%= ew_CurrentPage %>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td>
<% If Not IsObject(donation_view.Pager) Then Set donation_view.Pager = ew_NewPrevNextPager(donation_view.lStartRec, donation_view.lDisplayRecs, donation_view.lTotalRecs) %>
<% If donation_view.Pager.RecordCount > 0 Then %>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="aspmaker"><%= Language.Phrase("Page") %>&nbsp;</span></td>
<!--first page button-->
	<% If donation_view.Pager.FirstButton.Enabled Then %>
	<td><a href="<%= donation_view.PageUrl %>start=<%= donation_view.Pager.FirstButton.Start %>"><img src="images/first.gif" alt="<%= Language.Phrase("PagerFirst") %>" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/firstdisab.gif" alt="<%= Language.Phrase("PagerFirst") %>" width="16" height="16" border="0"></td>
	<% End If %>
<!--previous page button-->
	<% If donation_view.Pager.PrevButton.Enabled Then %>
	<td><a href="<%= donation_view.PageUrl %>start=<%= donation_view.Pager.PrevButton.Start %>"><img src="images/prev.gif" alt="<%= Language.Phrase("PagerPrevious") %>" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/prevdisab.gif" alt="<%= Language.Phrase("PagerPrevious") %>" width="16" height="16" border="0"></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="<%= EW_TABLE_PAGE_NO %>" id="<%= EW_TABLE_PAGE_NO %>" value="<%= donation_view.Pager.CurrentPage %>" size="4"></td>
<!--next page button-->
	<% If donation_view.Pager.NextButton.Enabled Then %>
	<td><a href="<%= donation_view.PageUrl %>start=<%= donation_view.Pager.NextButton.Start %>"><img src="images/next.gif" alt="<%= Language.Phrase("PagerNext") %>" width="16" height="16" border="0"></a></td>
	<% Else %>
	<td><img src="images/nextdisab.gif" alt="<%= Language.Phrase("PagerNext") %>" width="16" height="16" border="0"></td>
	<% End If %>
<!--last page button-->
	<% If donation_view.Pager.LastButton.Enabled Then %>
	<td><a href="<%= donation_view.PageUrl %>start=<%= donation_view.Pager.LastButton.Start %>"><img src="images/last.gif" alt="<%= Language.Phrase("PagerLast") %>" width="16" height="16" border="0"></a></td>	
	<% Else %>
	<td><img src="images/lastdisab.gif" alt="<%= Language.Phrase("PagerLast") %>" width="16" height="16" border="0"></td>
	<% End If %>
	<td><span class="aspmaker">&nbsp;<%= Language.Phrase("Of") %>&nbsp;<%= donation_view.Pager.PageCount %></span></td>
	</tr></table>
<% Else %>
	<% If donation_view.sSrchWhere = "0=101" Then %>
	<span class="aspmaker"><%= Language.Phrase("EnterSearchCriteria") %></span>
	<% Else %>
	<span class="aspmaker"><%= Language.Phrase("NoRecord") %></span>
	<% End If %>
<% End If %>
		</td>
	</tr>
</table>
</form>
<% End If %>
<p>
<% If donation.Export = "" Then %>
<script language="JavaScript" type="text/javascript">
<!--
// Write your table-specific startup script here
// document.write("page loaded");
//-->
</script>
<% End If %>
<!--#include file="lc_footer.asp"-->
<%

' Drop page object
Set donation_view = Nothing
%>
<%

' -----------------------------------------------------------------
' Page Class
'
Class cdonation_view

	' Page ID
	Public Property Get PageID()
		PageID = "view"
	End Property

	' Table Name
	Public Property Get TableName()
		TableName = "donation"
	End Property

	' Page Object Name
	Public Property Get PageObjName()
		PageObjName = "donation_view"
	End Property

	' Page Name
	Public Property Get PageName()
		PageName = ew_CurrentPage()
	End Property

	' Page Url
	Public Property Get PageUrl()
		PageUrl = ew_CurrentPage() & "?"
		If donation.UseTokenInUrl Then PageUrl = PageUrl & "t=" & donation.TableVar & "&" ' add page token
	End Property

	' Common urls
	Dim AddUrl
	Dim EditUrl
	Dim CopyUrl
	Dim DeleteUrl
	Dim ViewUrl
	Dim ListUrl

	' Export urls
	Dim ExportPrintUrl
	Dim ExportHtmlUrl
	Dim ExportExcelUrl
	Dim ExportWordUrl
	Dim ExportXmlUrl
	Dim ExportCsvUrl

	' Inline urls
	Dim InlineAddUrl
	Dim InlineCopyUrl
	Dim InlineEditUrl
	Dim GridAddUrl
	Dim GridEditUrl
	Dim MultiDeleteUrl
	Dim MultiUpdateUrl

	' Debug Message
	Dim m_DebugMsg

	Public Property Get DebugMsg()
		If m_DebugMsg <> "" Then
			DebugMsg = "<p>" & m_DebugMsg & "</p>"
		Else
			DebugMsg = ""
		End If
	End Property

	Public Property Let DebugMsg(v)
		If m_DebugMsg <> "" Then ' Append
			m_DebugMsg = m_DebugMsg & "<br>" & v
		Else
			m_DebugMsg = v
		End If
	End Property

	' Message
	Public Property Get Message()
		Message = Session(EW_SESSION_MESSAGE)
	End Property

	Public Property Let Message(v)
		If Session(EW_SESSION_MESSAGE) <> "" Then ' Append
			Session(EW_SESSION_MESSAGE) = Session(EW_SESSION_MESSAGE) & "<br>" & v
		Else
			Session(EW_SESSION_MESSAGE) = v
		End If
	End Property

	' Show Message
	Public Sub ShowMessage()
		Dim sMessage
		sMessage = Message
		Call Message_Showing(sMessage)
		If sMessage <> "" Then Response.Write "<p><span class=""ewMessage"">" & sMessage & "</span></p>"
		Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session
	End Sub

	' -----------------------
	'  Validate Page request
	'
	Public Function IsPageRequest()
		If donation.UseTokenInUrl Then
			IsPageRequest = False
			If Not (ObjForm Is Nothing) Then
				IsPageRequest = (donation.TableVar = ObjForm.GetValue("t"))
			End If
			If Request.QueryString("t").Count > 0 Then
				IsPageRequest = (donation.TableVar = Request.QueryString("t"))
			End If
		Else
			IsPageRequest = True
		End If
	End Function

	' -----------------------------------------------------------------
	'  Class initialize
	'  - init objects
	'  - open ADO connection
	'
	Private Sub Class_Initialize()
		StartTimer = Timer ' Init start time

		' Initialize language object
		Set Language = New cLanguage

		' Initialize table object
		Set donation = New cdonation

		' Initialize urls
		' Initialize other table object

		Set user = New cuser

		' Initialize form object
		Set ObjForm = Nothing

		' Intialize page id (for backward compatibility)
		EW_PAGE_ID = "view"

		' Initialize table name (for backward compatibility)
		EW_TABLE_NAME = "donation"

		' Open connection to the database
		Call ew_Connect()
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Init
	'  - called before page main
	'  - check Security
	'  - set up response header
	'  - call page load events
	'
	Sub Page_Init()
		Set Security = New cAdvancedSecurity
		If Not Security.IsLoggedIn() Then Call Security.AutoLogin()
		If Not Security.IsLoggedIn() Then
			Call Security.SaveLastUrl()
			Call Page_Terminate("lc_login.asp")
		End If

		' Get export parameters
		If Request.QueryString("export").Count > 0 Then
			donation.Export = Request.QueryString("export")
		ElseIf Request.ServerVariables("HTTP_CONTENT_TYPE") = "application/x-www-form-urlencoded" Then
			If Request.Form("exporttype").Count > 0 Then
				donation.Export = Request.Form("exporttype")
			End If
		Else
			donation.ExportReturnUrl = ew_CurrentUrl()
		End If
		gsExport = donation.Export ' Get export parameter, used in header
		gsExportFile = donation.TableVar ' Get export file, used in header
		If Request.QueryString("id").Count > 0 Then
			If gsExportFile <> "" Then gsExportFile = gsExportFile & "_"
			gsExportFile = gsExportFile & Request.QueryString("id")
		End If
		If donation.Export = "html" Or donation.Export = "email" Or donation.Export = "excel" Or donation.Export = "word" Then
			Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
		End If
		If donation.Export = "excel" Then
			Response.ContentType = "application/vnd.ms-excel;charset=gb2312"
			Response.AddHeader "Content-Disposition", "attachment; filename=" & gsExportFile & ".xls"
		End If

		' Global page loading event (in userfn7.asp)
		Call Page_Loading()

		' Page load event, used in current page
		Call Page_Load()
	End Sub

	' -----------------------------------------------------------------
	'  Class terminate
	'  - clean up page object
	'
	Private Sub Class_Terminate()
		Call Page_Terminate("")
	End Sub

	' -----------------------------------------------------------------
	'  Subroutine Page_Terminate
	'  - called when exit page
	'  - clean up ADO connection and objects
	'  - if url specified, redirect to url
	'
	Sub Page_Terminate(url)

		' Page unload event, used in current page
		Call Page_Unload()

		' Global page unloaded event (in userfn60.asp)
		Call Page_Unloaded()
		If Not (Conn Is Nothing) Then Conn.Close ' Close Connection
		Set Conn = Nothing
		Set Security = Nothing
		Set donation = Nothing
		Set ObjForm = Nothing

		' Go to url if specified
		Dim sRedirectUrl
		sReDirectUrl = url
		Call Page_Redirecting(sReDirectUrl)
		If sReDirectUrl <> "" Then
			If Response.Buffer Then Response.Clear
			Response.Redirect sReDirectUrl
		End If
	End Sub

	'
	'  Subroutine Page_Terminate (End)
	' ----------------------------------------

	Dim lDisplayRecs ' Number of display records
	Dim lStartRec, lStopRec, lTotalRecs, lRecRange
	Dim lRecCnt

	' -----------------------------------------------------------------
	' Page main processing
	'
	Sub Page_Main()

		' Paging variables
		lDisplayRecs = 1
		lRecRange = 10

		' Load current record
		Dim bLoadCurrentRecord
		bLoadCurrentRecord = False
		Dim sReturnUrl
		sReturnUrl = ""
		Dim bMatchRecord
		bMatchRecord = False
		If IsPageRequest Then ' Validate request
			If Request.QueryString("id").Count > 0 Then
				donation.id.QueryStringValue = Request.QueryString("id")
			Else
				bLoadCurrentRecord = True
			End If

			' Get action
			donation.CurrentAction = "I" ' Display form
			Select Case donation.CurrentAction
				Case "I" ' Get a record to display
					lStartRec = 1 ' Initialize start position
					Set Rs = LoadRecordset() ' Load records
					lTotalRecs = Rs.RecordCount ' Get record count
					If lTotalRecs <= 0 Then ' No record found
						Message = Language.Phrase("NoRecord") ' Set no record message
						sReturnUrl = "lc_donationlist.asp"
					ElseIf bLoadCurrentRecord Then ' Load current record position
						SetUpStartRec() ' Set up start record position

						' Point to current record
						If CLng(lStartRec) <= CLng(lTotalRecs) Then
							bMatchRecord = True
							Rs.Move lStartRec-1
						End If
					Else ' Match key values
						Do While Not Rs.Eof
							If CStr(donation.id.CurrentValue) = CStr(Rs("id")) Then
								donation.StartRecordNumber = lStartRec ' Save record position
								bMatchRecord = True
								Exit Do
							Else
								lStartRec = lStartRec + 1
								Rs.MoveNext
							End If
						Loop
					End If
					If Not bMatchRecord Then
						Message = Language.Phrase("NoRecord") ' Set no record message
						sReturnUrl = "lc_donationlist.asp" ' No matching record, return to list
					Else
						Call LoadRowValues(Rs) ' Load row values
					End If
			End Select

			' Export data only
			If donation.Export = "html" Or donation.Export = "csv" Or donation.Export = "word" Or donation.Export = "excel" Or donation.Export = "xml" Then
				Call ExportData()
				Call Page_Terminate("") ' Clean up
				Response.End
			ElseIf donation.Export = "email" Then
				Call ExportData()
				Response.End
			End If
		Else
			sReturnUrl = "lc_donationlist.asp" ' Not page request, return to list
		End If
		If sReturnUrl <> "" Then Call Page_Terminate(sReturnUrl)

		' Render row
		donation.RowType = EW_ROWTYPE_VIEW
		Call RenderRow()
	End Sub
	Dim Pager

	' -----------------------------------------------------------------
	' Set up Starting Record parameters based on Pager Navigation
	'
	Sub SetUpStartRec()
		Dim nPageNo

		' Exit if lDisplayRecs = 0
		If lDisplayRecs = 0 Then Exit Sub
		If IsPageRequest Then ' Validate request

			' Check for a START parameter
			If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then
				lStartRec = Request.QueryString(EW_TABLE_START_REC)
				donation.StartRecordNumber = lStartRec
			ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then
				nPageNo = Request.QueryString(EW_TABLE_PAGE_NO)
				If IsNumeric(nPageNo) Then
					lStartRec = (nPageNo-1)*lDisplayRecs+1
					If lStartRec <= 0 Then
						lStartRec = 1
					ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
						lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
					End If
					donation.StartRecordNumber = lStartRec
				End If
			End If
		End If
		lStartRec = donation.StartRecordNumber

		' Check if correct start record counter
		If Not IsNumeric(lStartRec) Or lStartRec = "" Then ' Avoid invalid start record counter
			lStartRec = 1 ' Reset start record counter
			donation.StartRecordNumber = lStartRec
		ElseIf CLng(lStartRec) > CLng(lTotalRecs) Then ' Avoid starting record > total records
			lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
			donation.StartRecordNumber = lStartRec
		ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
			lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
			donation.StartRecordNumber = lStartRec
		End If
	End Sub

	' -----------------------------------------------------------------
	' Load recordset
	'
	Function LoadRecordset()

		' Call Recordset Selecting event
		Call donation.Recordset_Selecting(donation.CurrentFilter)

		' Load list page sql
		Dim sSql
		sSql = donation.ListSQL
		If EW_DEBUG_ENABLED Then DebugMsg = "LoadRecordset: " & sSql ' Show SQL for debugging

		' Load recordset
		Dim RsRecordset
		Set RsRecordset = ew_LoadRecordset(sSql)

		' Call Recordset Selected event
		Call donation.Recordset_Selected(RsRecordset)
		Set LoadRecordset = RsRecordset
	End Function

	' -----------------------------------------------------------------
	' Load row based on key values
	'
	Function LoadRow()
		Dim RsRow, sSql, sFilter
		sFilter = donation.KeyFilter

		' Call Row Selecting event
		Call donation.Row_Selecting(sFilter)

		' Load sql based on filter
		donation.CurrentFilter = sFilter
		sSql = donation.SQL
		If EW_DEBUG_ENABLED Then DebugMsg = "LoadRow: " & sSql ' Show SQL for debugging
		Set RsRow = ew_LoadRow(sSql)
		If RsRow.Eof Then
			LoadRow = False
		Else
			LoadRow = True
			RsRow.MoveFirst
			Call LoadRowValues(RsRow) ' Load row values

			' Call Row Selected event
			Call donation.Row_Selected(RsRow)
		End If
		RsRow.Close
		Set RsRow = Nothing
	End Function

	' -----------------------------------------------------------------
	' Load row values from recordset
	'
	Sub LoadRowValues(RsRow)
		Dim sDetailFilter
		donation.id.DbValue = RsRow("id")
		donation.company_id.DbValue = RsRow("company_id")
		donation.donation_date.DbValue = RsRow("donation_date")
		donation.donation_content.DbValue = RsRow("donation_content")
		donation.donation_money.DbValue = RsRow("donation_money")
		donation.donation_flower.DbValue = RsRow("donation_flower")
		donation.donation_egg.DbValue = RsRow("donation_egg")
	End Sub

	' -----------------------------------------------------------------
	' Render row values based on field settings
	'
	Sub RenderRow()

		' Initialize urls
		ExportPrintUrl = PageUrl & "export=print&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		ExportHtmlUrl = PageUrl & "export=html&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		ExportExcelUrl = PageUrl & "export=excel&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		ExportWordUrl = PageUrl & "export=word&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		ExportXmlUrl = PageUrl & "export=xml&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		ExportCsvUrl = PageUrl & "export=csv&" & "id=" & Server.URLEncode(donation.id.CurrentValue)
		AddUrl = donation.AddUrl
		EditUrl = donation.EditUrl
		CopyUrl = donation.CopyUrl
		DeleteUrl = donation.DeleteUrl
		ListUrl = donation.ListUrl

		' Call Row Rendering event
		Call donation.Row_Rendering()

		' ---------------------------------------
		'  Common render codes for all row types
		' ---------------------------------------
		' id

		donation.id.CellCssStyle = ""
		donation.id.CellCssClass = ""

		' company_id
		donation.company_id.CellCssStyle = ""
		donation.company_id.CellCssClass = ""

		' donation_date
		donation.donation_date.CellCssStyle = ""
		donation.donation_date.CellCssClass = ""

		' donation_content
		donation.donation_content.CellCssStyle = ""
		donation.donation_content.CellCssClass = ""

		' donation_money
		donation.donation_money.CellCssStyle = ""
		donation.donation_money.CellCssClass = ""

		' donation_flower
		donation.donation_flower.CellCssStyle = ""
		donation.donation_flower.CellCssClass = ""

		' donation_egg
		donation.donation_egg.CellCssStyle = ""
		donation.donation_egg.CellCssClass = ""

		' -----------
		'  View  Row
		' -----------

		If donation.RowType = EW_ROWTYPE_VIEW Then ' View row

			' id
			donation.id.ViewValue = donation.id.CurrentValue
			donation.id.CssStyle = ""
			donation.id.CssClass = ""
			donation.id.ViewCustomAttributes = ""

			' company_id
			donation.company_id.ViewValue = donation.company_id.CurrentValue
			donation.company_id.CssStyle = ""
			donation.company_id.CssClass = ""
			donation.company_id.ViewCustomAttributes = ""

			' donation_date
			donation.donation_date.ViewValue = donation.donation_date.CurrentValue
			donation.donation_date.CssStyle = ""
			donation.donation_date.CssClass = ""
			donation.donation_date.ViewCustomAttributes = ""

			' donation_content
			donation.donation_content.ViewValue = donation.donation_content.CurrentValue
			donation.donation_content.CssStyle = ""
			donation.donation_content.CssClass = ""
			donation.donation_content.ViewCustomAttributes = ""

			' donation_money
			donation.donation_money.ViewValue = donation.donation_money.CurrentValue
			donation.donation_money.CssStyle = ""
			donation.donation_money.CssClass = ""
			donation.donation_money.ViewCustomAttributes = ""

			' donation_flower
			donation.donation_flower.ViewValue = donation.donation_flower.CurrentValue
			donation.donation_flower.CssStyle = ""
			donation.donation_flower.CssClass = ""
			donation.donation_flower.ViewCustomAttributes = ""

			' donation_egg
			donation.donation_egg.ViewValue = donation.donation_egg.CurrentValue
			donation.donation_egg.CssStyle = ""
			donation.donation_egg.CssClass = ""
			donation.donation_egg.ViewCustomAttributes = ""

			' View refer script
			' id

			donation.id.HrefValue = ""
			donation.id.TooltipValue = ""

			' company_id
			donation.company_id.HrefValue = ""
			donation.company_id.TooltipValue = ""

			' donation_date
			donation.donation_date.HrefValue = ""
			donation.donation_date.TooltipValue = ""

			' donation_content
			donation.donation_content.HrefValue = ""
			donation.donation_content.TooltipValue = ""

			' donation_money
			donation.donation_money.HrefValue = ""
			donation.donation_money.TooltipValue = ""

			' donation_flower
			donation.donation_flower.HrefValue = ""
			donation.donation_flower.TooltipValue = ""

			' donation_egg
			donation.donation_egg.HrefValue = ""
			donation.donation_egg.TooltipValue = ""
		End If

		' Call Row Rendered event
		Call donation.Row_Rendered()
	End Sub

	' -----------------------------------------------------------------
	' Export data in HTML/CSV/Word/Excel/XML/Email format
	'
	Sub ExportData()
		Dim oXmlDoc
		Dim sExportStr, sExportValue, sExportStyle
		Dim sOutputStr

		' Default export style
		sExportStyle = "v"

		' Load recordset
		Set Rs = LoadRecordset()
		lTotalRecs = Rs.RecordCount
		lStartRec = 1
			SetUpStartRec() ' Set Up Start Record Position

			' Set the last record to display
			If lDisplayRecs < 0 Then
				lStopRec = lTotalRecs
			Else
				lStopRec = lStartRec + lDisplayRecs - 1
			End If
		If donation.Export = "xml" Then
			Set oXmlDoc = New cXMLDocument
		Else
			sOutputStr = ew_ExportHeader(donation.Export)

			' Horizontal format, write header
			If sExportStyle <> "v" Or donation.Export = "csv" Then
				sExportStr = ""
				Call ew_ExportAddValue(sExportStr, donation.id.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.id.CellStyles, ""))
				Call ew_ExportAddValue(sExportStr, donation.company_id.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.company_id.CellStyles, ""))
				Call ew_ExportAddValue(sExportStr, donation.donation_date.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_date.CellStyles, ""))
				Call ew_ExportAddValue(sExportStr, donation.donation_money.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_money.CellStyles, ""))
				Call ew_ExportAddValue(sExportStr, donation.donation_flower.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_flower.CellStyles, ""))
				Call ew_ExportAddValue(sExportStr, donation.donation_egg.ExportCaption, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_egg.CellStyles, ""))
				sOutputStr = sOutputStr & ew_ExportLine(sExportStr, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.RowStyles, ""))
			End If
		End If

		' Move to first record
		lRecCnt = lStartRec - 1
		If Not Rs.Eof Then
			Rs.MoveFirst
			Rs.Move lStartRec - 1
		End If
		Do While (Not Rs.Eof) And (lRecCnt < lStopRec)
			lRecCnt = lRecCnt + 1
			If CLng(lRecCnt) >= CLng(lStartRec) Then
				Call LoadRowValues(Rs)

				' Render row for display
				donation.CssClass = ""
				donation.CssStyle = ""
				donation.RowType = EW_ROWTYPE_VIEW ' Render view
				Call RenderRow()
				If donation.Export = "xml" Then
					oXmlDoc.AddRow()

					' Field id
					Call oXmlDoc.AddField("id", donation.id.ExportValue(donation.Export, donation.ExportOriginalValue))

					' Field company_id
					Call oXmlDoc.AddField("company_id", donation.company_id.ExportValue(donation.Export, donation.ExportOriginalValue))

					' Field donation_date
					Call oXmlDoc.AddField("donation_date", donation.donation_date.ExportValue(donation.Export, donation.ExportOriginalValue))

					' Field donation_money
					Call oXmlDoc.AddField("donation_money", donation.donation_money.ExportValue(donation.Export, donation.ExportOriginalValue))

					' Field donation_flower
					Call oXmlDoc.AddField("donation_flower", donation.donation_flower.ExportValue(donation.Export, donation.ExportOriginalValue))

					' Field donation_egg
					Call oXmlDoc.AddField("donation_egg", donation.donation_egg.ExportValue(donation.Export, donation.ExportOriginalValue))
				Else

					' Vertical format
					If sExportStyle = "v" And donation.Export <> "csv" Then

						' Field id
						sOutputStr = sOutputStr & ew_ExportField(donation.id.ExportCaption, donation.id.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.id.CellStyles, ""))

						' Field company_id
						sOutputStr = sOutputStr & ew_ExportField(donation.company_id.ExportCaption, donation.company_id.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.company_id.CellStyles, ""))

						' Field donation_date
						sOutputStr = sOutputStr & ew_ExportField(donation.donation_date.ExportCaption, donation.donation_date.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_date.CellStyles, ""))

						' Field donation_money
						sOutputStr = sOutputStr & ew_ExportField(donation.donation_money.ExportCaption, donation.donation_money.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_money.CellStyles, ""))

						' Field donation_flower
						sOutputStr = sOutputStr & ew_ExportField(donation.donation_flower.ExportCaption, donation.donation_flower.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_flower.CellStyles, ""))

						' Field donation_egg
						sOutputStr = sOutputStr & ew_ExportField(donation.donation_egg.ExportCaption, donation.donation_egg.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_egg.CellStyles, ""))

					' Horizontal format
					Else
						sExportStr = ""

						' Field id
						Call ew_ExportAddValue(sExportStr, donation.id.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.id.CellStyles, ""))

						' Field company_id
						Call ew_ExportAddValue(sExportStr, donation.company_id.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.company_id.CellStyles, ""))

						' Field donation_date
						Call ew_ExportAddValue(sExportStr, donation.donation_date.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_date.CellStyles, ""))

						' Field donation_money
						Call ew_ExportAddValue(sExportStr, donation.donation_money.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_money.CellStyles, ""))

						' Field donation_flower
						Call ew_ExportAddValue(sExportStr, donation.donation_flower.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_flower.CellStyles, ""))

						' Field donation_egg
						Call ew_ExportAddValue(sExportStr, donation.donation_egg.ExportValue(donation.Export, donation.ExportOriginalValue), donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.donation_egg.CellStyles, ""))
						sOutputStr = sOutputStr & ew_ExportLine(sExportStr, donation.Export, ew_IIf(EW_EXPORT_CSS_STYLES, donation.RowStyles, ""))
					End If
				End If
			End If
			Rs.MoveNext
		Loop

		' Close recordset and connection
		Rs.Close
		Set Rs = Nothing
		If donation.Export = "xml" Then
			oXmlDoc.Encoding = "gb2312"
			oXmlDoc.Output
			Set oXmlDoc = Nothing
		Else
			sOutputStr = sOutputStr & ew_ExportFooter(donation.Export)
			If donation.Export = "email" Then
				Call ExportEmail(sOutputStr)
				Call Page_Terminate(donation.ExportReturnUrl)
			Else
				Response.Write sOutputStr
			End If
		End If
	End Sub

	' Page Load event
	Sub Page_Load()

		'Response.Write "Page Load"
	End Sub

	' Page Unload event
	Sub Page_Unload()

		'Response.Write "Page Unload"
	End Sub

	' Page Redirecting event
	Sub Page_Redirecting(url)

		'url = newurl
	End Sub

	' Message Showing event
	Sub Message_Showing(msg)

		'msg = newmsg
	End Sub
End Class
%>
